#include <bits/stdc++.h>
#define ll long long
using namespace std;

const int Mod=998244353;
const int Maxn=1e7+7,N=1e7;
int n,k;
ll fac[Maxn],Inv[Maxn],Idk[Maxn],fn[Maxn];
inline ll Binom(int x,int y){
	if(y>x or y<0) return 0;
	return fac[x]*Inv[y]%Mod*Inv[x-y]%Mod;
}
inline ll ksm(ll a,int b,int mod){
	ll z=1;
	while(b){
		if(b&1) z=z*a%mod;
		a=a*a%mod;
		b>>=1;
	}
	return z;
}

vector<int>prm;
bitset<Maxn>isp;
inline void Init(){
	Idk[1]=1;
	isp.set(0),isp.set(1);
	for(int i=2;i<=N;i++){
		if(!isp.test(i)) prm.emplace_back(i),Idk[i]=ksm(i,k,Mod);
		for(auto j:prm){
			const int t=i*j;
			if(t>N) break;
			Idk[t]=Idk[i]*Idk[j]%Mod;
			isp.set(t);
			if(!(i%j)) break;
		}
	}
}

int main(){
	freopen("length.in","r",stdin);
	freopen("length.out","w",stdout);
	scanf("%d%d",&n,&k);
	Init();
//	for(int i=1;i<=n;i++) cout<<Idk[i]<<endl;
	fn[0]=1;
	for(int i=1;i<=N;i++) fn[i]=fn[i-1]*n%Mod;
	fac[0]=1;
	for(int i=1;i<=N;i++) fac[i]=fac[i-1]*i%Mod;
	Inv[N]=ksm(fac[N],Mod-2,Mod);
	for(int i=N-1;~i;i--) Inv[i]=Inv[i+1]*(i+1)%Mod;
	
	ll ans=0;
	for(int i=1;i<=n;i++) ans=(ans+Binom(n,i)*fac[i-1]%Mod*Idk[i]%Mod*fn[n-i]%Mod)%Mod;
	printf("%lld",ans);
	
	return 0;
}

